package com.shop.zkmall.app.controller.a;

import com.shop.zkmall.app.service.buyer.CereBuyerUserService;
import com.shop.zkmall.app.service.notice.CereNoticeService;
import com.shop.zkmall.app.utils.LoginHelper;
import com.shop.zkmall.commons.domain.buyer.CereBuyerUser;
import com.shop.zkmall.commons.domain.common.PageParam;
import com.shop.zkmall.commons.result.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@Slf4j
@RestController
@RequestMapping("systemMessage")
@RequiredArgsConstructor
@Tag(name = "消息模块", description = "消息模块")
public class SystemMessageController {


    private final CereNoticeService cereNoticeService;
    private final CereBuyerUserService cereBuyerUserService;


    /**
     * 获取系统消息列表
     */
    @PostMapping("/getMessageList")
    @Operation(summary = "获取系统消息列表")
    public R<?> getMessageList(PageParam pageParam) {
        CereBuyerUser cereBuyerUser = cereBuyerUserService.selectByBuyerUserId(LoginHelper.getUserId());
        return R.ok(cereNoticeService.getAll(pageParam,cereBuyerUser));
    }
}
